package ioperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void word(BookList bookList) {
        System.out.println("请输入要查找的书籍");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getUseSize(); i++) {
            Book book = bookList.getPosBook(i);
            if(book.getName().equals(name))
            {
                System.out.println("找到了!");
                System.out.println(book);
                return;
            }
        }
        System.out.println("找不到你要的书籍");
    }
}
